<?php
/*
 * @Author: your name
 * @Date: 2021-12-07 09:50:02
 * @LastEditTime: 2021-12-31 14:39:02
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \property\app\Http\Controllers\find_shop\User.php
 */

namespace App\Http\Controllers\admin_controller;
use Illuminate\Support\Facades\Request;
use App\Models\admin_model\FindShopSubscribe as FindShopSubscribeDB;
class FindShopSubscribe extends BaseController{
      
     public function subscribeList(){
            $limitStr = '';
            $whereStr = '';
            if (Request::input('pageSize') && Request::input('page')) {
                $limitStr =   limit_joint(Request::input('page'), Request::input('pageSize'));
            }
            if(Request::has('keyWord')){
                $keyWord = array_filter(Request::input('keyWord'), 'filtrfunction');
                if(!empty($keyWord )){
                    $whereStr .= havaWhereLikeJoinEqual($keyWord);
                }
            }
            $list  = FindShopSubscribeDB::subscribeList( $whereStr,$limitStr);
            $total =  FindShopSubscribeDB::subscribeCount( $whereStr);
           return $this->create(200,'查询成功',['list'=>$list,'total'=>$total[0]['count']]);
         
     }
    
     public function subscribeEdit()
     {
        return  redis_mysql_edit('find_shop_subscribe');
     }
 
     public function subscribeBatchEdit(){
         if(Request::has('id') && Request::has('formData')){
             $res = redis_mysql_edit_in('find_shop_subscribe', Request::input('id'), Request::input('formData'));
            if($res){
                return $this->create(200,'编辑成功');
            }else{
               return $this->create(100,'编辑失败');
            }
         }
     }
     public function subscribeSelOne()
     {
        return   redis_mysql_selone('find_shop_subscribe');
     }
    

}